<template>
	<div class="header">
		<img src="@/assets/mobile/img/logo.png" class="logo" />
		<ul class="menus">
			<li>
				<router-link to="/mobile/home">首页推荐</router-link>
			</li>
			<li>
				<router-link to="/mobile/booklist">书库</router-link>
			</li>
			<li>
				<router-link to="/mobile/myhome">我的</router-link>
			</li>
		</ul>
		<div class="search" @click="goSearch()">
			<img src="@/assets/mobile/img/search.png" />
		</div>
	</div>
</template>

<script>
	export default {
		name: 'MobileHeader',
		data() {
			return {
				isaBool: false, //默认不启动动画
			}
		},
		methods: {
			goSearch() {
				this.$router.push('/mobile/search')
			}
		}
	}
</script>

<style scoped>
	.header {
		width: 100%;
		height: 3.5rem;
		background-color: #a58a5a;
		display: flex;
		align-items: center;
		justify-content: space-between;
		/* position: relative; 相对定位 保留原本的位置 */
		/* position: absolute; 绝对定位 抛弃原本的位置 */
		position: fixed;
		top: 0;
		z-index: 10;
	}

	.header .logo {
		margin-left: 0.5rem;
	}

	.header .menus {
		margin: 0;
		padding: 0;
		list-style: none;
		width: 55%;
		height: 100%;
		color: white;
		/* 默认显示, 动画开始时设置为隐藏状态 */
		display: block;
	}


	.header .menus li a {
		display: block;
		width: 33.33%;
		float: left;
		height: 3.5rem;
		line-height: 3.5rem;
		text-align: center;
		color: white;
	}

	.header .menus li .router-link-active {
		border-bottom: 0.3rem solid gold;
		color: gold;
	}

	.header .search {
		/* position: relative;
		right: 0.5rem; */
		/* 默认div标签没有宽带,动画开始时设置20rem的宽度 */
		width: 2rem;
		height: 2rem;
		border-radius: 50%;
		border: 1px solid white;
		margin-right: 0.5rem;
		display: flex;
		align-items: center;
		justify-content: center;
	}



	/* PC端的事件; 事件: 手指事件/手势事件 touch*/
	/* hover属于PC端的鼠标事件,不适合在移动端运行 */
	/* .header .search:hover{
	   /* 动画的名字 动画的时长 动画的速度 */
	/*animation: formWidth 1s linear;
	  } */
	/* 将宽度从2rem————>20rem */
	@keyframes formWidth {
		0% {
			width: 2rem;
		}

		100% {
			width: 20rem;
		}
	}
</style>
